package com.lagou.demo.controller;

import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@LagouController
@LagouRequestMapping("/demo2")
@Security(value={"zhangsan","lisi","wangwu"})
public class Demo2Controller {
    ///demo2/hello1
    @LagouRequestMapping("/hello1")
    @Security(value = {"zhangsan"})
    public String hello1(HttpServletRequest request, HttpServletResponse response, String name) {
        try {
            response.getWriter().print("hello1! " + name);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "";
    }

    @LagouRequestMapping("/hello2")
    @Security(value = {"zhangsan", "lisi"})
    public String hello2(HttpServletRequest request, HttpServletResponse response, String name) {
        try {
            response.getWriter().print("hello2! " + name);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "";
    }

    @LagouRequestMapping("/hello3")
    public String hello3(HttpServletRequest request, HttpServletResponse response, String name) {
        try {
            response.getWriter().print("hello3! " + name);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "";
    }



}
